package com.example.timecalculous;

import android.app.Activity;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.DatePicker;

import com.example.data.TimeData;

import java.util.Calendar;

/**
 * Created by ASUS on 2017/2/18.
 */

public class DatePickerClass extends Activity {
    DatePicker datePicker;
    int year,month,day;
    String year1=null,month1=null,day1=null;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.datepicker);
        Calendar calendar = Calendar.getInstance();
        year = calendar.get(Calendar.YEAR);
        month = calendar.get(Calendar.MONTH);
        day = calendar.get(Calendar.DAY_OF_MONTH);
        datePicker = (DatePicker) findViewById(R.id.datePicker1);
        datePicker.init(year, month, day, new DatePicker.OnDateChangedListener() {
            @Override
            public void onDateChanged(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
                year1 = String.valueOf(year);
                month1 = String.valueOf(monthOfYear);
                day1 = String.valueOf(dayOfMonth);
                Intent intent = new Intent(DatePickerClass.this, MainActivity.class);
                startActivity(intent);
            }
        });
    }
}
